<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="lib/react.js"></script>
    <script src="lib/react-dom.js"></script>
    <script src="lib/browser.js"></script>
</head>
<body>
    

    <div  id="root"></div>

    <script  type="text/babel">

        
        const Book = React.createClass({
            render(){
                return (
                    <div>
                        <h1> this is a { this.props.name } - ￥{this.props.price} </h1>    
                    </div>
                )
            }
        }) 


        const libs = {
            name:"国家图书馆",
            books:[
                {title:"三体",price:12},
                {title:"北京折叠",price:22},
                {title:"明灭",price:32}
            ]
        }

        const Library = (props) => {


            let o = props.data.name + "@@@@@"

            let name = props.data.name;
            let books = props.data.books;
            return (
                <div>
                    <h1>{o}</h1>
                    <Book name={books[0].title} price={books[0].price}/>
                    <Book name={books[1].title} price={books[1].price}/>
                    <Book name={books[2].title} price={books[2].price}/>
                   
                </div>
            )
        }


        //jsx     javascript + xml  
        ReactDOM.render(<Library  data={libs} />,document.getElementById("root"))

    </script>
</body>
</html>